<template>
  <div>
    <ul>
      <li v-for="(message) in messages" :key="message.id">
        <router-link :to="`/home/messages/messagesDetail/${message.id}`">{{ message.title }}</router-link>
        <button @click="pushShow(message.id)">push查看</button>
        <button @click="repleceShow(message.id)">replece查看</button>
      </li>
      <button @click="$router.back()">返回</button>
    </ul>
    <hr/>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "Messages",
  data() {
    return {
      messages: [
        {id: 1, title: 'Message001', content: 'message content00111....'},
        {id: 3, title: 'Message003', content: 'message content00222....'},
        {id: 5, title: 'Message005', content: 'message content00333....'}
      ]
    }
  },
  methods: {
    pushShow(id) {
      this.$router.push(`/home/messages/messagesDetail/${id}`)
    },
    repleceShow(id) {
      this.$router.replace(`/home/messages/messagesDetail/${id}`)

    }

  }
}
</script>

<style scoped>

</style>
